<?php
class Sb_Ctrl_Admin_Base extends Sb_Ctrl
{
    protected function preDispatch()
    {
        $this->_view->pageTitle = 'Tikal Admin';
        $this->_view->contentTitle = 'Tikal Admin';
        parent::preDispatch();
    }

    protected function postDispatch()
    {
        $this->_view->pageContent = 'Tikal Admin';
        parent::postDispatch();
    }
    
    protected function getModel()
    {
    	$ctrlNameArr = explode('_', get_class($this));
    	$modelName = 'Sb_Model_'.$ctrlNameArr[count($ctrlNameArr)-1];
    	return new $modelName();
    }
    
    public function delAction()
    {
    	$this->_view->setDisableView(true);
    	$id = (int)$this->_http->getParam('id');
    	$model = $this->getModel();
    	$model->delete($id);
    	header('Content-type: text/json');
		header('Content-type: application/json');
		echo json_encode(array('done' => true));
    }
    
    public function filterAction()
    {
    	$this->_view->setDisableView(true);
    	$id = (int)$this->_http->getParam('id');
    	$model = $this->getModel();
    	$model->delete($id);
    }
}